﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PhotoGalleryEnteties;
using PhotogalleryModel;

namespace photogalleryMVC.Models
{
    public class PagingData
    {
        public int CurrentPage;
        public int ItemsOnPage;
    }

    public class User
    {
        public User(GalleryUser user)
        {
            UserName = user.UserName;
            UserMail = user.Email;
            UserRole = user.RoleName;
        }

        public string UserName;
        public string UserMail;
        public string UserRole;
    }

    public class  UserList
    {
        public UserList(ItemsPage<GalleryUser > users,int totalPages ,int onPage,IEnumerable<string> allowedRoles )
        {
            this.TotalPages = totalPages;
            this.AllowedRoles = allowedRoles;
            this.PagingData = new PagingData() {CurrentPage = users.PageNumber, ItemsOnPage = onPage};
            this.Users = users.Page.Select(p => new User(p));

        }
        
        public IEnumerable<User> Users;
        public IEnumerable<string> AllowedRoles;
        public PagingData PagingData;
        public int TotalPages;
    }
}